//
//  YGScienceLowerTypeView.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/29.
//

#import "YGScienceLowerTypeView.h"

@interface YGScienceLowerTypeView ()


@property (nonatomic, strong) UIButton *lowerTypeBtn;
@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UILabel *lowerTypeLabel;

@end

@implementation YGScienceLowerTypeView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initconstraints];
    }
    return self;
}

-(void)initView{
    [self addSubview:self.lowerTypeBtn];
    [self.lowerTypeBtn addSubview:self.imgView];
    [self.lowerTypeBtn addSubview:self.lowerTypeLabel];
}

-(void)initconstraints{
    [self.lowerTypeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.bottom.mas_equalTo(self);
    }];
    
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.lowerTypeBtn.mas_top);
            make.centerX.mas_equalTo(self.lowerTypeBtn.mas_centerX);
            make.width.mas_equalTo(50);
            make.height.mas_equalTo(50);
    }];
    
    [self.lowerTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.imgView.mas_bottom).offset(5);
            make.centerX.mas_equalTo(self.mas_centerX);
            make.width.mas_equalTo(self.mas_width);
            make.height.mas_equalTo(12);
    }];
}

#pragma event
-(void)clickLowerTypeAction{
    
}

#pragma setter

- (UIButton *)lowerTypeBtn{
    if (!_lowerTypeBtn) {
        _lowerTypeBtn = [[UIButton alloc]init];
        [_lowerTypeBtn addTarget:self action:@selector(clickLowerTypeAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _lowerTypeBtn;
}

- (UIImageView *)imgView{
    if (!_imgView) {
        _imgView = [[UIImageView alloc]init];
    }
    return _imgView;
}

- (UILabel *)lowerTypeLabel{
    if (!_lowerTypeLabel) {
        _lowerTypeLabel = [[UILabel alloc]init];
        _lowerTypeLabel.font = [UIFont systemFontOfSize:12];
        _lowerTypeLabel.textColor = UIColorFromRGB(0x333333);
    }
    return _lowerTypeLabel;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
